15.9.2021

Überblick

  1. Motivation

  2. Item Response Theorie

  3. IRT-Modelle in R

  4. Inferenzstatistik

  5. Satz von Bayes

  6. Bayes’sche Statistik-Pakete in R

  7. IRT und GLM

  8. Bayes’sche IRT in R

Was ich voraussetze:
  • R & RStudio
  • Pipeoperator %>%
  • Item Response Theorie
  • Differenzierung zw. frequentistischer und Bayesianischer Inferenzstatistik

Motivation

  • Professionswissens von Chemie-Studierenden mit Lehramtsoption
  • deklarativ-fachdidaktischer Wissenstest
Itemstamm 059MC

Motivation

  • Professionswissens von Chemie-Studierenden mit Lehramtsoption
  • deklarativ-fachdidaktischer Wissenstest
Antwortoptionen 059MC
Grafik aus Zhang, Miller & Cannady (2011)

Motivation

  • Professionswissens von Chemie-Studierenden mit Lehramtsoption
  • deklarativ-fachdidaktischer Wissenstest
  • Bayes’sches MIRT-Modell ab 100 Personen (Fujimoto & Neugebauer, 2020)
Biasreduzierender Effekt informativer Priors; Grafik aus Fujimoto & Neugebauer (2020)

Motivation

  • Professionswissens von Chemie-Studierenden mit Lehramtsoption
  • deklarativ-fachdidaktischer Wissenstest
  • Bayes’sches MIRT-Modell ab 100 Personen (Fujimoto & Neugebauer, 2020)
  • Bayes’sche IRT Modellierung mit brms (Bürkner, 2019)
Posterior Predictive Model Check (PPMC); Grafik aus Bürkner (2020)

Motivation

Shiny-App für den direkten Modellvergleich

Motivation

  • Professionswissens von Chemie-Studierenden mit Lehramtsoption
  • deklarativ-fachdidaktischer Wissenstest
  • Bayes’sches MIRT-Modell ab 100 Personen (Fujimoto & Neugebauer, 2020)
  • Bayes’sche IRT Modellierung mit brms (Bürkner, 2019)
  • Marginal Likelihood für Modellvergleiche (Merkle, Furr & Rabe-Hesketh, 2019)
Informationskriterien unter Nutzung der conditional und marginal likelihood; Grafik aus Merkle, Furr & Rabe-Hesketh (2019)

Item Response Theorie

  • latente Variablen
    • Personenfähigkeiten \(\theta_k\)
    • Itemparameter \(\beta_i, \alpha_i, \dots\)
  • logistisches Modell (GLM)
  • lokale Unabhängigkeit
Raschmodell:

\[P\left(1|\theta_k, \beta_i\right)=\frac{\exp\left(\theta_k + \beta_i\right)}{1+\exp\left(\theta_k + \beta_i\right)}\]

Grafik aus Grottke, Möhrke & Marvin (2021)
Ausnahmen:
  • latente Regression
  • Testlets

Item Response Theorie

Vorgehensweise:
  1. Forschungsfragen aufstellen
  2. Erhebung planen
  3. Testinstrument entwickeln
  4. Daten vorbereiten
## # A tibble: 6 x 13
##   person    i1    i2    i3    i4    i5    i6    i7    i8    i9   i10   i11   i12
##    <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1      1     1     1     1     0     1     1     0     0     0     0     0     0
## 2      2     1     1     1     0     1     1     0     0     0     0     0     0
## 3      3     1     1     1     1     1     1     0     1     1     1     1     0
## 4      4     1     1     0     1     1     0     0     0     1     0     0     0
## 5      5     0     1     1     1     1     1     1     1     1     1     1     1
## 6      6     0     1     1     1     1     1     0     1     0     0     0     0
Einfaches Item aus Ravens SPM;
Grafik aus Schoevers, Kroesbergen & Kattou (2020)

Item Response Theorie

Vorgehensweise:
  1. Forschungsfragen aufstellen
  2. Erhebung planen
  3. Testinstrument entwickeln
  4. Daten vorbereiten
  5. Modell formulieren
  6. Modell fitten
  • TAM, mirt
  • eRm, lme4
  • flirt (Jeon & Rijmen, 2016)

IRT-Modelle mit TAM

mod1PL <- TAM::tam.mml(resp=data_spm[-1])
## TAM 3.7-16 (2021-06-24 14:31:37) 
## 
## Call:
## TAM::tam.mml(resp = data_spm[-1])
## 
## Multidimensional Item Response Model in TAM 
## 
## Deviance= 5696.41  | Log Likelihood= -2848.21 
## Number of persons used= 499 
## Number of estimated parameters= 13 
## AIC= 5722 
## BIC= 5777

IRT-Modelle mit TAM

mod1PL <- TAM::tam.mml(resp=data_spm[-1])

head(mod1PL$item)
##   item alpha      beta
## 1   i1     1 -1.688258
## 2   i2     1 -3.258694
## 3   i3     1 -2.052729
## 4   i4     1 -2.235983
## 5   i5     1 -2.561512
## 6   i6     1 -1.719598

Item Response Theorie

Vorgehensweise:
  1. Forschungsfragen aufstellen
  2. Erhebung planen
  3. Testinstrument entwickeln
  4. Daten vorbereiten
  5. Modell formulieren
  6. Modell fitten
  7. Modellpassung prüfen
  1. Konvergenz
  2. Reliabilität
mod1PL$EAP.rel
## [1] 0.7968854

Item Response Theorie

Vorgehensweise:
  1. Forschungsfragen aufstellen
  2. Erhebung planen
  3. Testinstrument entwickeln
  4. Daten vorbereiten
  5. Modell formulieren
  6. Modell fitten
  7. Modellpassung prüfen
  8. Itemselektion
plot(mod1PL, items = c(8,12), 
     ngroups = 6, export = FALSE)

IRT-Modelle mit TAM

mod1PL <- TAM::tam.mml(resp=data_spm[-1])

head(mod1PL$item)

TAM::msq.itemfit(mod1PL) %>% 
  mutate_if(is.numeric,
            ~round(.x, 2)) %>% 
  head()
##    item Outfit Outfit_p Infit Infit_p
## 1    i1   1.73     0.00  1.23    0.00
## 2    i2   0.83     0.80  0.94    0.64
## 3    i3   1.10     0.64  0.99    0.92
## 4    i4   0.61     0.11  0.80    0.01
## 5    i5   0.53     0.10  0.77    0.01
## 6    i6   0.87     0.56  0.87    0.04
## 7    i7   1.04     0.77  1.03    0.62
## 8    i8   0.97     0.83  0.99    0.80
## 9    i9   1.19     0.12  1.08    0.13
## 10  i10   0.88     0.33  0.94    0.28
## 11  i11   1.77     0.00  0.97    0.55
## 12  i12   1.98     0.00  1.09    0.14

IRT-Modelle mit TAM

mod1PL <- TAM::tam.mml(resp=data_spm[-1])

head(mod1PL$item)

TAM::msq.itemfit(mod1PL) %>% 
  mutate_if(is.numeric,
            ~round(.x, 2)) %>% 
  head()

thetas_1pl <- TAM::tam.wle(mod1PL)
item_xsis_1pl <- mod1PL$xsi$xsi

ShinyItemAnalysis::ggWrightMap(
  thetas_1pl$theta,
  item_xsis_1pl,
  color = "#ffffff")

Item Response Theorie

Vorgehensweise:
  1. Forschungsfragen aufstellen
  2. Erhebung planen
  3. Testinstrument entwickeln
  4. Daten vorbereiten
  5. Modell formulieren
  6. Modell fitten
  7. Modellpassung prüfen
  8. Itemselektion
  9. Forschungsfragen untersuchen
Theoretisches Konstrukt:
  • Dimensionsanalyse
  • Modellvergleiche
Prädiktoren:
  • Varianzanalyse
  • Kriterien:
    • Signifikanz
    • Effektstärken
Alternativen:
  • latente Regression
  • SEM

Bayes’sche IRT-Modellierung in R

Vorgehensweise:
  1. Forschungsfragen aufstellen
  2. Erhebung planen
  3. Testinstrument entwickeln
  4. Daten vorbereiten
(data_spm_long <- data_spm %>%
  birtms::compose_dataset(
    response_columns = i1:i12))
## # A tibble: 5,988 x 3
##    person item  response
##    <chr>  <chr>    <dbl>
##  1 1      i1           1
##  2 1      i2           1
##  3 1      i3           1
##  4 1      i4           0
##  5 1      i5           1
##  6 1      i6           1
##  7 1      i7           0
##  8 1      i8           0
##  9 1      i9           0
## 10 1      i10          0
## # ... with 5,978 more rows

Bayes’sche IRT-Modellierung in R

Vorgehensweise:
  1. Forschungsfragen aufstellen
  2. Erhebung planen
  3. Testinstrument entwickeln
  4. Daten vorbereiten
  5. Modell formulieren
Modelle spezifizieren
  • Stan syntax:
    • rstan
    • edstan
  • GLM syntax: brms
  • Keyword based: birtms

Bayes’sche IRT-Modellierung in R

(formula1PL <- birtms::build_formula())
## response ~ 1 + (1 | person) + (1 | item)
(formula1PL_fw <- birtms::build_formula(
  variable_specifications = list(
    person_covariables_main_effect = "fw"
)))
## response ~ 1 + (1 | person) + (1 | item) + fw
(formula2PL <- birtms::build_formula(model_specifications = list(item_parameter_number = 2)))
## response ~ skillintercept + exp(logalpha) * theta + beta 
## skillintercept ~ 1
## theta ~ 0 + (1 | person)
## logalpha ~ 1 + (1 | item)
## beta ~ 0 + (1 | item)

Bayes’sche IRT-Modellierung in R

Vorgehensweise:
  1. Forschungsfragen aufstellen
  2. Erhebung planen
  3. Testinstrument entwickeln
  4. Daten vorbereiten
  5. Modell formulieren
  6. Vorannahmen formulieren
prior_1PL <- brms::prior("normal(0, 3)", class = "sd", group = "person") +
  brms::prior("normal(0, 3)", class = "sd", group = "item")

Bayes’sche IRT-Modellierung in R

Vorgehensweise:
  1. Forschungsfragen aufstellen
  2. Erhebung planen
  3. Testinstrument entwickeln
  4. Daten vorbereiten
  5. Modell formulieren
  6. Vorannahmen formulieren
prior_1PL_gender <- brms::prior("normal(0, 3)", class = "sd", group = "person") +
  brms::prior("normal(0, 3)", class = "sd", group = "item") +
  brms::prior("constant(0)", class = "b", coef = "genderm") +
  brms::prior("normal(1, 0.5)", class = "b", group = "genderw")

Bayes’sche IRT-Modellierung in R

data_spm_long_gender <- data_spm_long %>% mutate(
  gender = ifelse(as.integer(person) %% 2 == 1, "m", "w"),
  gender = ifelse(as.integer(person) %% 23 == 1, "d", gender))

brms::get_prior(formula = formula1PL_gender,
                data = data_spm_long_gender)
##                 prior     class      coef  group resp dpar nlpar bound       source
##                (flat)         b                                             default
##                (flat)         b   genderm                              (vectorized)
##                (flat)         b   genderw                              (vectorized)
##  student_t(3, 0, 2.5) Intercept                                             default
##  student_t(3, 0, 2.5)        sd                                             default
##  student_t(3, 0, 2.5)        sd             item                       (vectorized)
##  student_t(3, 0, 2.5)        sd Intercept   item                       (vectorized)
##  student_t(3, 0, 2.5)        sd           person                       (vectorized)
##  student_t(3, 0, 2.5)        sd Intercept person                       (vectorized)

Bayes’sche IRT-Modellierung in R

Vorgehensweise:
  1. Forschungsfragen aufstellen
  2. Erhebung planen
  3. Testinstrument entwickeln
  4. Daten vorbereiten
  5. Modell formulieren
  6. Vorannahmen formulieren
  7. Modell fitten
Code- und Modell-Transformation
Variable TAM brms
Zeit in s 0.06 57 + 81
Iterationen 36 4000 + 4000 + X
Speicher in MB 0.46 34.73
Werte je Parameter 3 4000

MCMC-Sampling-Applets

Bayes’sche IRT-Modellierung in R

fit_1d_1pl_spm <- birtms::birtm(data = data_spm_long,
                                formula = formula1PL,
                                prior = prior_1PL,
                                file = "models/fit_1d_1pl_spm",
                                cores = 4
                                )
fit_1d_1pl_spm_gender <- birtms::birtm(data = data_spm_long,
                                       formula = formula1PL_gender,
                                       prior = prior_1PL_gender,
                                       file = "models/fit_1d_1pl_spm_gender",
                                       variable_specifications = list(
                                         person_covariables_main_effect = "gender"
                                         )
                                       )

Bayes’sche IRT-Modellierung in R

fit_1d_2pl_spm <- birtms::birtm(data = data_spm_long,
                                formula = formula2PL,
                                prior = prior_2PL,
                                file = "models/fit_1d_2pl_spm",
                                model_specifications = list(
                                  item_parameter_number = 2
                                  )
                                )
fit_1d_2pl_spm <- birtms::birtm_aio(data = data_spm,
                                    response_columns = i1:i12,
                                    prior = prior_2PL,
                                    file = "models/fit_1d_2pl_spm",
                                    model_specifications = list(
                                      item_parameter_number = 2
                                      )
                                    )

Bayes’sche IRT-Modellierung in R

Vorgehensweise:
  1. Forschungsfragen aufstellen
  2. Erhebung planen
  3. Testinstrument entwickeln
  4. Daten vorbereiten
  5. Modell formulieren
  6. Vorannahmen formulieren
  7. Modell fitten
  8. Modellpassung prüfen
plot(fit_1d_1pl_spm)

https://mc-stan.org/shinystan/

Bayes’sche IRT-Modellierung in R

summary(fit_1d_1pl_spm, robust = TRUE)
##  Family: bernoulli 
##   Links: mu = logit 
## Formula: response ~ 1 + (1 | person) + (1 | item) 
##    Data: data (Number of observations: 5988) 
##   Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
##          total post-warmup draws = 4000
## 
## Group-Level Effects: 
## ~item (Number of levels: 12) 
##               Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept)     1.49      0.32     1.02     2.46 1.00     1193     2063
## 
## ~person (Number of levels: 499) 
##               Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept)     1.68      0.08     1.54     1.85 1.00     1561     2524
## 
## Population-Level Effects: 
##           Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## Intercept     1.05      0.43     0.18     2.02 1.01      682     1213
## 
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

Bayes’sche IRT-Modellierung in R

bayesplot::mcmc_trace(
  fit_1d_1pl_spm, pars = c("b_Intercept")
  )

Grafik von Clark (2018)

Bayes’sche IRT-Modellierung in R

Vorgehensweise:
  1. Forschungsfragen aufstellen
  2. Erhebung planen
  3. Testinstrument entwickeln
  4. Daten vorbereiten
  5. Modell formulieren
  6. Vorannahmen formulieren
  7. Modell fitten
  8. Modellpassung prüfen
  1. Konvergenz
  2. ESS

Bayes’sche IRT-Modellierung in R

Vorgehensweise:
  1. Forschungsfragen aufstellen
  2. Erhebung planen
  3. Testinstrument entwickeln
  4. Daten vorbereiten
  5. Modell formulieren
  6. Vorannahmen formulieren
  7. Modell fitten
  8. Modellpassung prüfen
  9. Itemselektion
Itemcheck mit birtms
  • Itemparameterverteilungen
  • Item Characteristic Curves
  • Posterior Predictive Model Checks
  • Wrightmap
  • Odds Ratio Heatmaps

Bayes’sche IRT-Modellierung in R

cowplot::plot_grid(
  birtms::plot_itemparameter(
    fit_1d_2pl_spm, pars = "slope", 
    style = "halfeye", items = c(1,4),
    alphacut = c(.4, .6, 2),
    thresholds = c(0,4)),
  birtms::plot_itemparameter(
    fit_1d_2pl_spm, pars = "difficulty", 
    style = "halfeye", items = c(1,4), 
    thresholds = c(-3,3)), 
  nrow = 2
  )

Bayes’sche IRT-Modellierung in R

Bayes’sche IRT-Modellierung in R

i1_easyness <- brms::ranef(fit_1d_1pl_spm, summary = FALSE)$item[,"i1",1]
head(i1_easyness, n = 10) %>% round(2)
##  [1] 0.89 0.54 1.20 0.36 0.57 0.67 0.97 0.55 1.29 1.18
i1_easyness %>% birtms::plot_ppmc_distribution()

Bayes’sche IRT-Modellierung in R

Grafik aus Kruschke (2015)

Grafiken mittels Code von Hyvönen & Tolonen (2019)

Bayes’sche IRT-Modellierung in R

g_spm_1pl <- birtms::ICC_check(fit_1d_1pl_spm, post_responses = posterior_responses_spm_1pl,
                                num_groups = 6, item_id = 12)

Bayes’sche IRT-Modellierung in R

g_spm_2pl <- birtms::ICC_check(fit_1d_2pl_spm, post_responses = posterior_responses_spm_1pl,
                                num_groups = 6, item_id = 12)

Bayes’sche IRT-Modellierung in R

g_spm_2pl <- birtms::ICC_check(fit_1d_2pl_spm, post_responses = posterior_responses_spm_1pl,
                                num_groups = 10, item_id = 12)

Bayes’sche IRT-Modellierung in R

ppmc_data_spm_1pl_mixed <- fit_1d_1pl_spm %>% birtms::get_ppmcdatasets(
  ppmcMethod = 'M', post_responses = posterior_responses_spm_1pl)

ppmc_data_spm_1pl_outfit_mixed <- fit_1d_1pl_spm %>% birtms::get_ppmccriteria(
  ppmcdata = ppmc_data_spm_1pl_mixed, ppmcMethod = 'M', criteria = 'outfit')

outfit_skim_1pl <- ppmc_data_spm_1pl_outfit_mixed %>% group_by(item) %>% 
  select(item, crit) %>% birtms::custom_skim() %>% 
  rename_all(~str_remove(.x, "numeric.")) %>% 
  mutate_if(is.numeric, ~round(.x, 2))

Bayes’sche IRT-Modellierung in R

outfit_skim_1pl %>% select(item, mean, mode, hdi.lower, hdi.upper)
## # A tibble: 12 x 5
##    item   mean  mode hdi.lower hdi.upper
##    <chr> <dbl> <dbl>     <dbl>     <dbl>
##  1 i1    1.73  1.53      1.27      2.16 
##  2 i10   0.887 0.861     0.780     0.986
##  3 i11   1.79  1.66      1.22      2.27 
##  4 i12   1.98  1.83      1.37      2.55 
##  5 i2    0.825 0.701     0.487     1.11 
##  6 i3    1.11  1.02      0.753     1.41 
##  7 i4    0.611 0.581     0.495     0.726
##  8 i5    0.533 0.495     0.415     0.639
##  9 i6    0.878 0.828     0.650     1.08 
## 10 i7    1.05  0.988     0.864     1.23 
## 11 i8    0.974 0.955     0.835     1.10 
## 12 i9    1.20  1.17      1.00      1.38

Bayes’sche IRT-Modellierung in R

birtms::plot_fit_statistic(model = fit_1d_1pl_spm, data = ppmc_data_spm_1pl_outfit_mixed, 
                           units = c(1,12), ppmcMethod = 'M')

Bayes’sche IRT-Modellierung in R

ppmc_infit_data <- setNames(data.frame(ppmc_data_spm_1pl_outfit_mixed[,c(1,5)],
             ppmc_data_spm_2pl_outfit_mixed[,c(5)]), c('item', '1pl', '2pl'))

ggplot(data = ppmc_infit_data) + 
  geom_density(aes(`1pl`), colour = '#8b7d6b70', fill = '#8b7d6b70', alpha = 0.3) +
  geom_density(aes(`2pl`), colour = '#008b4570', fill = '#008b4570', alpha = 0.3) +
  facet_wrap("item", scales = "free") + xlim(c(-2,2))

Bayes’sche IRT-Modellierung in R

Bayes’sche IRT-Modellierung in R

fit_1d_1pl_spm %>% birtms::plot_wrightmap(classic = FALSE)

Bayes’sche IRT-Modellierung in R

ordata_1pl_spm <- fit_1d_1pl_spm %>% birtms::get_or(zero_correction = 'Haldane')

ordata_1pl_spm_fullbayes <- fit_1d_1pl_spm %>% birtms::get_or(zero_correction = 'Bayes',
                                                      ci_method = 'BayesHDI')

ordata_2pl_spm <- fit_1d_2pl_spm %>% birtms::get_or(zero_correction = 'Haldane')

ordata_2pl_spm_fullbayes <- fit_1d_2pl_spm %>% birtms::get_or(zero_correction = 'Bayes',
                                                      ci_method = 'BayesHDI')

Bayes’sche IRT-Modellierung in R

Odds-ratio PPMC

ordata_1pl_spm_fullbayes %>% 
  birtms::plot_ppmc_or_heatmap()
ordata_2pl_spm_fullbayes %>% 
  birtms::plot_ppmc_or_heatmap()

Bayes’sche IRT-Modellierung in R

Odds-ratio-Limit-Check

ordata_1pl_spm_fullbayes %>% 
  birtms::plot_or_heatmap()
ordata_2pl_spm_fullbayes %>% 
  birtms::plot_or_heatmap(model = fit_1d_2pl_spm)

Bayes’sche IRT-Modellierung in R

Odds-ratio-Limit-Check

ordata_1pl_spm_fullbayes %>% 
  birtms::plot_or_heatmap(model = fit_1d_2pl_spm, bayesian = TRUE)
ordata_2pl_spm_fullbayes %>% 
  birtms::plot_or_heatmap(model = fit_1d_2pl_spm)

{eval=TRUE, results='hide', fig.keep='all',r eval=TRUE, results='hide', fig.keep='all', out.width="130%", message=FALSE} ordata_2pl_spm_fullbayes %>% birtms::plot_or_heatmap(itemrange = c(1,12), model = fit_1d_2pl_spm, bayesian = TRUE)

Bayes’sche IRT-Modellierung in R

Vorgehensweise:
  1. Forschungsfragen aufstellen
  2. Erhebung planen
  3. Testinstrument entwickeln
  4. Daten vorbereiten
  5. Modell formulieren
  6. Vorannahmen formulieren
  7. Modell fitten
  8. Modellpassung prüfen
  9. Itemselektion
Personcheck mit birtms
  • Posterior Predictive Model Checks
  • Person Response Functions

Bayes’sche IRT-Modellierung in R

ppmc_data_spm_1pl <- fit_1d_1pl_spm %>% 
  birtms::get_ppmcdatasets(
    ppmcMethod = 'C', post_responses = posterior_responses_spm_1pl
    )

ppmc_data_spm_1pl_person_ll <- fit_1d_1pl_spm %>% 
  birtms::get_ppmccriteria(
    ppmcdata = ppmc_data_spm_1pl, ppmcMethod = 'C', criteria = 'll', 
    group = .$var_specs$person
    )

fit_1d_1pl_spm %>% birtms::plot_fit_statistic(
  data = ppmc_data_spm_1pl_person_ll, units = c(1,12), group = .$var_specs$person
  )

Bayes’sche IRT-Modellierung in R

Bayes’sche IRT-Modellierung in R

respfuncdata_1pl <- fit_1d_1pl_spm %>%birtms::calc_personresponsedata(
  post_responses = posterior_responses_spm_1pl)

birtms::plot_personresponsefunction(fit_1d_1pl_spm, respfuncdata_1pl, id = c(2:4))

Bayes’sche IRT-Modellierung in R

Vorgehensweise:
  1. Forschungsfragen aufstellen
  2. Erhebung planen
  3. Testinstrument entwickeln
  4. Daten vorbereiten
  5. Modell formulieren
  6. Vorannahmen formulieren
  7. Modell fitten
  8. Modellpassung prüfen
  9. Itemselektion
  10. Forschungsfragen untersuchen
Theoretisches Konstrukt:
  • Dimensionsanalyse
  • Modellvergleiche mit birtms
  • leave-one-out crossvalidation
    • marginal loglikelihood
    • entferne alle Antworten einer Person
Alternativen
  • grouped k-fold crossvalidation
  • Bayes Factor via bridgesampling

Bayes’sche IRT-Modellierung in R

conditional loo
marginal loo

Bayes’sche IRT-Modellierung in R

Bayes’sche IRT-Modellierung in R

marg_loo1pl <- birtms::loo_marginal(fit_1d_1pl_spm)
marg_loo1pl <- birtms::loo_marginal(fit_1d_2pl_spm)
loo::loo_compare(marg_loo1pl, marg_loo2pl)
##        elpd_diff se_diff
## model2   0.0       0.0  
## model1 -25.4      11.1

Bayes’sche IRT-Modellierung in R

Vorgehensweise:
  1. Forschungsfragen aufstellen
  2. Erhebung planen
  3. Testinstrument entwickeln
  4. Daten vorbereiten
  5. Modell formulieren
  6. Vorannahmen formulieren
  7. Modell fitten
  8. Modellpassung prüfen
  9. Itemselektion
  10. Forschungsfragen untersuchen
Prädiktoren:
  • latente Regression
  • ROPE + HDI
  • Varianzanalyse

birtms

latente Regression mit birtms
  • bayes’sche Variante des \(R^2\)-Bestimmtheitsmaß

Ausblick

Funktionalitäten

  • testlets
  • Shiny-App
  • 3pl
  • Itemkriterien (vgl. Scharl & Gnambs, 2019)
  • hierarchic
  • ordinal
  • multidim
  • multivariate
  • 4pl
  • noncompensatory

Paket

  • Dokumentation
  • Vignetten
  • Videotutorials
  • Performance
  • Vereinheitlichung
  • Abhängigkeiten reduzieren
  • Mehrsprachigkeit

Zusammenfassung

  • Aufruf
    • zur Zusammenarbeit
    • zur kritischen Prüfung

Inferenzstatistik

Münzwurf: 0, 1, 1, 1, 1, 1, 1, 1, 1

\(X \sim binom(n, p)\)

Aspekt Klassisch / Frequentistisch Bayes’sch / Bayesianisch
Wahrscheinlichkeit relative Häufigkeit Grad persönlicher Überzeugung
Vorannahme Münze fair Münze fair (SD = .10)

Inferenzstatistik

Münzwurf: 0, 1, 1, 1, 1, 1, 1, 1, 1

\(X \sim binom(n, p)\)

Aspekt Klassisch / Frequentistisch Bayes’sch / Bayesianisch
Wahrscheinlichkeit relative Häufigkeit Grad persönlicher Überzeugung
Vorannahme Münze fair Münze fair (SD = .10)
P(X=1) = 0.89 [0.69, 1]
Hypothesentest 0.021
Entscheidung nicht fair

Inferenzstatistik

Münzwurf: 0, 1, 1, 1, 1, 1, 1, 1, 1

\(X \sim binom(n, p)\)

Aspekt Klassisch / Frequentistisch Bayes’sch / Bayesianisch
Wahrscheinlichkeit relative Häufigkeit Grad persönlicher Überzeugung
Vorannahme Münze fair Münze fair (SD = .10)
P(X=1) = 0.89 [0.69, 1]
Hypothesentest 0.021
Entscheidung nicht fair
Grafik erstellt mit JASP Team (2020)

Inferenzstatistik

Münzwurf: 0, 1, 1, 1, 1, 1, 1, 1, 1

\(X \sim binom(n, p)\)

Aspekt Klassisch / Frequentistisch Bayes’sch / Bayesianisch
Wahrscheinlichkeit relative Häufigkeit Grad persönlicher Überzeugung
Vorannahme Münze fair Münze fair (SD = .29)
P(X=1) = 0.89 [0.69, 1]
Hypothesentest 0.021
Entscheidung nicht fair
Grafik erstellt mit JASP Team (2020)

Inferenzstatistik

Modell: \(X \sim binom(n, p)\)

Beendigung der Datenerhebung nach:

  1. 9 Würfen
  2. 8 mal Kopf
  3. 1 Minute

p-value: Die Wahrscheinlichkeit in einer Stichprobe der hypothetischen Population ein Ergebnis zu erhalten, dass mindestens so extrem wie das vorliegende Ergebnis ist, wobei die beabsichtigten Erhebungs- und Auswertungsmethoden berücksichtigt werden müssen.

Grafik aus Kruschke (2015)

Inferenzstatistik

Grafik nach Kruschke (2015)


zweite Münze 24 mal werfen: \(p\left(\frac{z_1}{N_1}\right) = 0.063\)
zweite Münze 12 mal werfen: \(p\left(\frac{z_1}{N_1}\right) = 0.103\)

Inferenzstatistik

  • sind Nägel fair?
  • 7 von 24 stehen
  • verwerfen die Hypothese nicht!
  • Vorwissen berücksichtigen
    • Berücksichtigung seltener Ereignisse
    • bedeutsame Parametervergleiche
    • Datensätze erweitern
  • Einfluss des Priors nimmt mit Datenmenge ab
https://xkcd.com/1132/

Inferenzstatistik

  • Ablehnen der Nullhypothese spricht nicht für Alternativhypothese
  • Bayes-Faktor: pro H0, ungewiss, pro H1
  • Informationsverlust
    • behindert Metaaanalysen
  • Parameterwerte und CIs statt NHST?
    • Effektstärke
    • CI enthält Werte, die von NHST nicht abgelehnt würden
    • frequentistische CIs auch vom Sample Space abhängig
    Grafik aus Kruschke & Liddell (2018)
Grafik aus Kruschke & Liddell (2018)

Inferenzstatistik

Mehls Paradox ROPE

Grafik aus Waning, Montagne, McCloskey & Maki (2001)

Inferenzstatistik

Grafik aus Waning, Montagne, McCloskey & Maki (2001)

Inferenzstatistik Backlog

Klassisch

  • Parameter haben einen festen Wert, den wir schätzen wollen
    • ein CI sagt nicht, dass der Wert einer Verteilung unterliegt, sondern nur, in welchem Beeich der wahre Wert liegen sollte
  • \(\alpha\)-Fehler Korrektur
    • in höchstens \(\alpha \, %\) der Wiederholungen ist überhaupt ein Parameter außerhalb der CI

Bayes’sch

  • CI: Kredibilitätsintervall Ergebnis von Simulation
    • Parameterverteilung zeigt, die wahrscheinlichten Werte an
    • Breite \(\sim\) Unsicherheit
    • HDI statt equallt tailed CI
    • Median oder Modalwert statt Mittelwert
    • Passendes zentrales Maß anhand der Parameterverteilung wählbar
    • Bimodale und schiefe Verteilungen identifizierbar
  • Hardware
    • braucht mehr Rechenzyklen
    • braucht mehr Arbeitsspeicher (oder noch mehr Zeit)
    • braucht mehr Festplattenspeicher
  • können Unsicherheit in Folgeanalysen mitberücksichtigen
  • prädiktive Modelle
  • Messunsicherheit berücksichtigen
  • fehlende Werte imputieren
  • nutzen wir die Möglichkeit der Priors in den IRT-Modellen schon?
  • likelihood / Posterior unabhängig von Testanzahl
  • poweranalysis by simulation
  • PPMC mit oder ohne p-value?

Satz von Bayes

\[ P(A|B) = \frac{P(B|A) \cdot P(A)}{P(B)}\]

Angewendet auf Modelle: \[ P(Parameter|Daten) = \frac{P(Daten|Parameter) \cdot P(Parameter)}{P(Daten)}\]

Gesprochen: \[ \mathbf{Posterior\:Wahrs.} = \frac{\mathbf{Modellfunktion} \cdot \mathbf{Prior\:Wahrs.}}{\mathbf{Normierungsfaktor}}\]

Bayes’sche Statistik-Pakete in R

Modelle fitten

  • Stan:
    • rstan
    • rstanarm
    • brms
  • JAGS: rjags
  • rethinking
  • BayesFactor
  • blavaan

Modelle auswerten

  • tidybayes
  • loo
  • bayestestR
  • bayesplot
  • coda, plotMCMC
  • bridgesampling

Hypothesentests und Modellvergleiche

  • Hypothesen-Modell-Beziehung N:M
  • Modell verwerfen \(\nLeftrightarrow\) Hypothese verwerfen

\[\begin{align} y &\sim item + person + fw \\ y &\sim item + person + fw^2 \\ y &\sim item + person + fw*rpk \end{align}\]

\(fw\): Fachwissen
\(rpk\): Repräsentationskenntnis

Grafik aus McElreath (2020)

Bayes’sche IRT

  1. Daten vorbereiten
  2. Modell formulieren
  3. Konvergenz der MCMC-Chains prüfen (\(\hat{r}\), plots)
  4. Posterior Predictive Model Checking

Modellvergleiche

  • Dimensionalitätsanalysen
  • Prädiktorenwahl
  • Wirkungsmodelle prüfen (DAGs)

Parameterinspektion

  • Itemselektion
  • DIF
  • Effektstärken
  • \(\dots\)

Literatur

Bürkner, P.-C. (2019). Bayesian Item Response Modeling in R with brms and Stan. Verfügbar unter: https://arxiv.org/pdf/1905.09501

Bürkner, P.-C. (2020). Analysing Standard Progressive Matrices (SPM-LS) with Bayesian Item Response Models. Journal of Intelligence, 8(1). https://doi.org/10.3390/jintelligence8010005

Clark, M. (2018). Bayesian Basics. Verfügbar unter: https://m-clark.github.io/bayesian-basics/diagnostics.html

Fujimoto, K. A. & Neugebauer, S. R. (2020). A General Bayesian Multidimensional Item Response Theory Model for Small and Large Samples. Educational and psychological measurement, 80(4), 665–694. https://doi.org/10.1177/0013164419891205

Grottke, T., Möhrke, P. & Marvin, R. (2021). Statistische Analysen mit R in den MINT-Didaktiken Eine Tutorial-Sammlung: 4 Praxisorientierte Einf ührung in die Item-Response-Theorie mit dem Fokus auf das Rasch-Modell. Verfügbar unter: https://dbuschhue.github.io/P4-Worflow/praxisorientierte-einf

Haberman, S. J., Holland, P. W. & Sinharay, S. (2007). Limits on Log Odds Ratios for Unidimensional Item Response Theory Models. Psychometrika, 72(4), 551–561. https://doi.org/10.1007/S11336-007-9009-0

Hyvönen, V. H. & Tolonen, T. (2019). Chapter 3 Summarizing the posterior distribution | Bayesian Inference 2019. Verfügbar unter: https://vioshyvo.github.io/Bayesian_inference/summarizing-the-posterior-distribution.html

JASP Team. (2020). JASP (Version 0.14.1)[Computer software]. Verfügbar unter: https://jasp-stats.org/

Jeon, M. & Rijmen, F. (2016). A modular approach for item response theory modeling with the R package flirt. Behavior research methods, 48(2), 742–755. https://doi.org/10.3758/s13428-015-0606-z

Kruschke, J. K. (2015). Doing Bayesian data analysis: A tutorial with R, JAGS, and Stan (2. ed.). Amsterdam: AP Academic Press/Elsevier. Verfügbar unter: http://www.contentreserve.com/TitleInfo.asp?ID=38F45CF6-6B5C-433C-85F8-A3568420927D&Format=50

Kruschke, J. K. & Liddell, T. M. (2018). The Bayesian New Statistics: Hypothesis testing, estimation, meta-analysis, and power analysis from a Bayesian perspective. Psychonomic Bulletin & Review, 25(1), 178–206. https://doi.org/10.3758/s13423-016-1221-4

Kruschke, J. K. & Liddell, T. M. (2018). The Bayesian New Statistics: Hypothesis testing, estimation, meta-analysis, and power analysis from a Bayesian perspective. Psychonomic Bulletin & Review, 25(1), 178–206. https://doi.org/10.3758/s13423-016-1221-4

McElreath, R. (2020). Statistical Rethinking. Chapman and Hall/CRC. https://doi.org/10.1201/9780429029608

Merkle, E. C., Furr, D. & Rabe-Hesketh, S. (2019). Bayesian Comparison of Latent Variable Models: Conditional Versus Marginal Likelihoods. Psychometrika, 84(3), 802–829. https://doi.org/10.1007/s11336-019-09679-0

Scharl, A. & Gnambs, T. (2019). Longitudinal item response modeling and posterior predictive checking in R and Stan. The Quantitative Methods for Psychology, 15(2), 75–95. https://doi.org/10.20982/tqmp.15.2.p075

Schoevers, E. M., Kroesbergen, E. H. & Kattou, M. (2020). Mathematical Creativity: A Combination of Domain–general Creative and Domain–specific Mathematical Skills. The Journal of Creative Behavior, 54(2), 242–252. https://doi.org/10.1002/jocb.361

Waning, B., Montagne, M., McCloskey, W. W. & Maki, R. A. (2001). Pharmacoepidemiology: Principles and practice. New York: McGraw-Hill. Verfügbar unter: http://www.loc.gov/catdir/bios/mh041/00045207.html

Zhang, O., Miller, D. & Cannady, M. (2011). A Model Evaluation When Associations Exists Across Testlets under Small Testlet Size Situations. Verfügbar unter: https://ouzhang.me/pdf/2011NCME2_slide.pdf